package com.alibaba.aone.casestudy.module.screen;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.aone.casestudy.common.entity.Action;
import com.alibaba.aone.casestudy.common.entity.Casestudy;
import com.alibaba.aone.casestudy.common.entity.CasestudyAnalysisParticipant;
import com.alibaba.aone.casestudy.common.entity.Failure;
import com.alibaba.aone.casestudy.service.ActionService;
import com.alibaba.aone.casestudy.service.CasestudyService;
import com.alibaba.aone.casestudy.service.FailureService;
import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.dataresolver.Param;

public class CaseStudyDetailEdit {
	@Autowired
	private CasestudyService casestudyService;

	@Autowired
	private FailureService failureService;

	@Autowired
	private ActionService actionService;

	public void execute(Context context,
			@Param("casestudyNo") String casestudyNo) {
		// List<Action> actions = actionService.listActions();
		Casestudy casestudy = casestudyService
				.getCasestudyByNumber(casestudyNo);
		Failure failure = failureService.getFailureByNumber(casestudy
				.getSourceNumber());
		List<Action> actions = actionService
				.getActionsByCasestudyNo(casestudyNo);
		// actionService.getActionByNumber(actionNo)

		List<CasestudyAnalysisParticipant> analysisPartis = casestudyService
				.getAnalysisPartisByCasestudyno(casestudyNo);

		context.put("casestudy", casestudy);
		context.put("failure", failure);
		context.put("actions", actions);
		context.put("analysisPartis", analysisPartis);
	}
}
